#ifndef _QGCM_INTEGRATORS_
#define _QGCM_INTEGRATORS_

#include "qgcmio.h"
#include "model.h"
#include "psystem.h"
#include "ssystem.h"
#include <list>

class psystem;

#ifdef DEBUG
class REALARRAY;
#else
#define REALARRAY qgcomplex *
#endif

struct intoutputinfo {
	qstream outfile;
	// phi stuff
	bool displayphi;
	bool rundiagnosticsblock;
	bool displayPsys;
	bool displayLOP;
	bool nosys; // do not integrate the S-system
	bool nouetssys; // set system not to march forward unequal time fields
	bool nohup; // ignore SIGHUP signals during integration 
	vector< int > tprimeintegrations; // only integrate the tprimes listed here in linear integration (not valid for NONLINEAR mode).
	struct {
		std::list<INDEX> t_offset_indices;
		std::list<INDEX> i_indices;
		std::list<INDEX> j_indices;
		std::list<INDEX> m_indices;
		std::list<INDEX> k_indices;
		int t_freq;
		int t_prime_freq;
		bool displayfourierspace;
		bool equaltimeonly;
	} phidisplayoptions;
	struct {
		int t_freq;
	} psysdisplayoptions;
	intoutputinfo();
};

// void dumpphi(const unsigned int & ksize, const unsigned int & nksize, const unsigned int & nfields,const REALARRAY & phi);

//void pintegrate(model_class & mo, psystem & p, REAL timestep, int numsteps, int writefreq, FILE * out);

// global signals used to change the behavior of the system while running
void catch_signal_while_integrating(int);

void pintegrate(model_class & mo, const unsigned int & numsteps, const intoutputinfo & options);

#endif
